﻿namespace PrismEx.SampleApp.Modules.ShowDialog
{
    using System.Collections.Generic;
    using System.ComponentModel.Composition;
    using System.Windows;

    using Microsoft.Expression.Interactivity.Core;
    using Microsoft.Practices.Prism.Commands;

    using PrismEx.Base;
    using PrismEx.Modules.DialogService;

    public interface IDialogViewModel : IDialogContent
    {
        
    }

    [Export]
    public class MyDialogViewModel : Observable, IDialogViewModel
    {
        public string Title
        {
            get
            {
                return "This is my dialog";
            }
        }

        public IEnumerable<DialogCommand> Commands
        {
            get
            {
                return new[]
                    {
                        new DialogCommand
                            {
                                IsDialogTerminator = true, 
                                Content = "OK", 
                                Command = new ActionCommand(() => MessageBox.Show("This will close the dialog once you click OK")),
                                Order = 3
                            },
                            new DialogCommand
                            {
                                IsDialogTerminator = true, 
                                Content = "Cancel", 
                                Command = new ActionCommand(() => MessageBox.Show("This will close the dialog once you click OK")),
                                Order = 2
                            },
                            new DialogCommand
                            {
                                IsDialogTerminator = false, 
                                Content = "Apply", 
                                Command = new DelegateCommand(() => MessageBox.Show("This will NOT close the dialog once you click OK")),
                                Order = 1
                            }
                    };
            }
        }
    }
}